Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add v4 chunk format to chunks-inspect tool #13057

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

slim-bean
Copy link
Collaborator

What this PR does / why we need it:

The chunks-inspect tool was never updated to parse the newer v4 chunk with structured metadata, this PR fixes that

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@slim-bean slim-bean requested a review from a team as a code owner May 28, 2024 21:22
cmd/chunks-inspect/main.go Outdated Show resolved Hide resolved
@agebhar1
Copy link
Contributor

agebhar1 commented Jun 5, 2024

Did the same in #11506.

@cstyan
Copy link
Contributor

cstyan commented Jul 12, 2024

@agebhar1's PR is merged so I'm going to close this

@cstyan cstyan closed this Jul 12, 2024
@slim-bean slim-bean reopened this Dec 13, 2024
slim-bean added a commit that referenced this pull request Dec 13, 2024
…'clean room' implementation able to decode chunks without importing any Loki code, this update undid that implementation and we would prefer to keep it as a "clean room" type application

Signed-off-by: Edward Welch <edward.welch@grafana.com>
@slim-bean slim-bean mentioned this pull request Dec 13, 2024
6 tasks
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Signed-off-by: Edward Welch <edward.welch@grafana.com>
@slim-bean
Copy link
Collaborator Author

re-opening this PR after reverting the other implementation, it's preferable that this tool does not import any Loki code to decompress chunks, rather it's able to do so by implementing the chunk format directly

Copy link
Collaborator

@JoaoBraveCoding JoaoBraveCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm

Comment on lines +183 to +184
//expCRC := binary.BigEndian.Uint32(data[structuredMetadataOffset+structuredMetadataLength:])
//computedMetaChecksum := crc32.Checksum(lb, castagnoliTable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code, looks like a left over


structuredMetadata := data[structuredMetadataOffset : structuredMetadataOffset+structuredMetadataLength]

// Structured Metadata is "normalized" or "compressed" by storing an index to a string with each log line, and then all the strings in the chunk metadata section
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: By reading the code not sure I understand the "normalized" part of this comment, but maybe I'm just missing context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants